package com.jiangyifen.robot.sdkserver.requesthandler;

import javax.annotation.PostConstruct;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

import com.jiangyifen.robot.sdk.response.BaseResponse;
import com.jiangyifen.robot.service.RobotService;

import io.netty.channel.ChannelHandlerContext;

public abstract class AbstractRequestHandler<T> {
	
	protected Logger logger = LoggerFactory.getLogger(this.getClass());
	
	@Autowired
	protected RobotService robotService;
	
	@PostConstruct
	public void register(){
		HandlerMap.handlerMap.put(requestName(), this);
	}

	public abstract String requestName();
	
	public abstract  BaseResponse<T> handle(ChannelHandlerContext ctx, String requestId, String requestBody);
	
}